var mysql = require('mysql');

var pool = mysql.createPool({
    host:"localhost",
    user:"root",
    password:"s104881472waz",
    database:"libmanage",
    port: '1350',
    connectionLimit: 10,
});


function query(sql,callback){
    pool.getConnection(function(err,connection){
        connection.query(sql,function(err,rows){
            callback(err,rows);
            //释放链接
            connection.release();
        });
    });
}
function query2(sql,callback){
    pool.getConnection(function(err,connection){
        connection.query(sql,function(err,rows){
            callback(err,rows);
            //释放链接
            return rows;
            connection.release();
        });
    });
}



exports.query = query;